home *** CD-ROM | disk | FTP | other *** search
/ BUG 10 / BUGCD1998_01.ISO / aplic / pm65 / archive.z / Merge Framed Stories.SPT < prev    next >
Encoding:
Text File  |  1996-12-09  |  1.4 KB  |  61 lines

  1. -- Merge Framed Stories
  2. -- 10 November 96, vs
  3.  
  4. -- This script will merge two framed stories
  5. -- into a single threaded story.  You need to
  6. -- select the last frame of one story and the first
  7. -- frame of another story.
  8. -- (Caution: If the text blocks contain hyperlink
  9. -- sources or anchors, they may be moved to an
  10. -- unexpected position by this script.)
  11.  
  12. getselectidlist >> n,id1,z1,...,...,...,...,...,...,...,...,...,...,...,...,...,id2,z2,...
  13. if not(n=2)
  14.     message "Invalid state, two objects must be selected."
  15.     return
  16. endif
  17. selectid id1
  18. getisframe >> f1
  19. try getnextframe 1 >> id1.prev
  20. try getnextframe 0 >> id1.next
  21. selectid id2
  22. getisframe >> f2
  23. try getnextframe 1 >> id2.prev
  24. try getnextframe 0 >> id2.next
  25. if f1*f2=0
  26.     message "Invalid state"
  27.     return
  28. endif
  29. if (id1.next = -1)*(id2.prev =-1)
  30.   goto validState
  31. endif
  32. if (id1.prev = -1)*(id2.next =-1)
  33.   id1,id2 = id2,id1
  34.   goto validState
  35. endif
  36. message "Invalid state.  You need to select the last frame of one story "
  37. message "and the first frame of another story."
  38. return
  39. label validState
  40. selectid id2
  41. textedit;selectall;cut;deselect
  42. try linkframes 2,id1,id2
  43. getlasterror >> err
  44. if err
  45.  selectid id2
  46.  getobjectloc center >> c
  47.  newstory c
  48.  paste
  49.  message "Cannot link selected frames."
  50.  return
  51. endif
  52. selectid id1
  53. textedit
  54. textcursor +story
  55. paste
  56. deselect
  57. selectid id1
  58. selectidextend id2
  59. return
  60.  
  61.